<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/6/24
 * Time: 16:03
 */
//var_dump($_POST);
$classId= $_POST['class_id'] ?? '';
$className = $_POST['class_name'] ?? '';

// 修改班级id为$classId，他的信息为新的信息
$dsn = "sqlsrv:Server=localhost;Database=Student";
$db = new PDO($dsn, "sa", "123456");

$sql = "update Class set ClassName='{$className}' where ClassId = '{$classId}'";
$result = $db->exec($sql);
if ($result) {
    echo '修改成功，前往<a href="list.php">列表页</a>';
} else {
    echo '修改失败';
}